package disk;

import java.util.Arrays;

/**
 * 目录类
 * 
 * @author vincent
 * 
 */
public class Folder extends DirectoryEntry {
	/**
	 * 构造函数
	 */
	public Folder(byte[] name) {
		// TODO 自动生成的构造函数存根
		this(name, new byte[2], FileAttribute.ISFOLDER, (byte) -1, (byte) -1);
	}

	/**
	 * 构造函数
	 * 
	 * @param name
	 * @param typeName
	 * @param attribute
	 * @param blockIndex
	 * @param length
	 */
	public Folder(byte[] name, byte[] typeName, byte attribute,
			byte blockIndex, byte length) {
		super(name, typeName, attribute, blockIndex, length);
	}

	/**
	 * 获取目录名
	 * 
	 * @return
	 */
	public String getCompleteName() {
		int actLength = 0;
		for (int i = 0; i < name.length; i++) {
			if (name[i] == 0) {
				break;
			}
			actLength++;
		}
		String string = new String(Arrays.copyOf(name, actLength));
		return string;
	}
}
